package com.sunplus.system.registration.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.sunplus.common.core.controller.BaseController;
import com.sunplus.common.core.domain.AjaxResult;
import com.sunplus.system.registration.domain.PortalArticletype;
import com.sunplus.system.registration.service.IPortalArticletypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 文章类别Controller
 *
 * @author sunplus
 * @date 2021-03-25
 */
@RestController
@RequestMapping("/app/")
public class AppPortalArticletypeController extends BaseController {
    @Autowired
    private IPortalArticletypeService portalArticletypeService;

    /**
     * 查询文章类别列表
     */

    @GetMapping("portalarticletype/list")
    public AjaxResult list(PortalArticletype portalArticletype) {
        portalArticletype.setIsshowSel(0L);
        portalArticletype.setIsBanner(0L);
        List<PortalArticletype> list = portalArticletypeService.selectPortalArticletypeList(portalArticletype);
        return AjaxResult.success(list);
    }

    /**
     * /**
     * 获取文章类别详细信息
     */
    @GetMapping(value = "portalarticletype/{pid}")
    public AjaxResult getInfo(@PathVariable("pid") String pid) {
        return AjaxResult.success(portalArticletypeService.selectPortalArticletypeById(pid));
    }


}
